import type { FieldRule } from 'vant'

export const mobileRules = [
  { pattern: /^1[3-9]\d{9}$/, message: '请输入正确手机号' },
  { required: true, message: '输入内容不能为空' }
]

export const passwordRules = [
  { required: true, message: '密码不能为空' },
  { pattern: /^[\s\S]{6,24}$/, message: '请输入6-24为数字字符' }
]

export const nameRules: FieldRule[] = [
  { required: true, message: '请输入姓名' },
  { pattern: /^(?:[\u4e00-\u9fa5·]{2,16})$/, message: '中文2-16个字符' }
]

export const idCardRules: FieldRule[] = [
  { required: true, message: '请输入身份证号' },
  {
    pattern:
      /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
    message: '身份证号不正确'
  }
]
